Prefetching
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
Prefetching is used in various areas of computing, including CPU architectures and operating systems. It can be implemented in both hardware and software, and it relies on detecting access patterns that suggest what data is likely to be needed soon.
Contents
• Overview
• Hardware
• Software
• See also
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Overview
Prefetching works by predicting which memory addresses or resources will be accessing and load them into faster access storage, like caches.cite-ref-0-1-1[1]
Prefetching may be used:
• Hardware-level, such as CPU memory controllers
Hardware
• Correlation prefetching learns patterns between cache misses and triggers prefetches based on those patternscite-ref-1-2-2[2]
Software
Prefetch instructions can be written into the code by the programmer or by the compiler. Prefetch instructions specify the memory addresses to be prefetched and the desired prefetch distance.cite-ref-1-2-3[2]
In software, there are instructions that can be written with:
• prefetch on x86 architecture
• __builtin_prefetch in the GCC compiler
• _mm_prefetch in the Intel Intrinsics Guide
Operating systems
Operating systems use prefetching to reduce file and memory access latency.
Web Browsers
Web browsers apply prefetching techniques to improve perceived performance. Common examples include:
Limitations
Prefetching can significantly improve performance, but it can not always be beneficial if implemented wrong. If predictions are inaccurate, prefetching may waste bandwidth, processing time, or cause cache pollution. In systems with limited resources or highly unpredictable workloads, prefetching can degrade performance rather than improve it.cite-ref-0-1-4[1]
Implementing both software and hardware prefetching can also lead to degraded performance because of interactions that might occur between each other from how it was implemented.cite-ref-6[6]
See also
References
cite-note-0-11. ↑ "Intel® 64 and IA-32 Architectures Optimization Reference Manual Volume 1". Intel. 2023-09-05. Retrieved 2025-04-24.
cite-note-1-22. ↑ citerefhurlin2009Hur, Ibrahim; Lin, Calvin (February 2009). "Feedback mechanisms for improving probabilistic memory prefetching". 2009 IEEE 15th International Symposium on High Performance Computer Architecture. IEEE. pp. 443–454. doi:10.1109/hpca.2009.4798282. ISBN 978-1-4244-2932-5.
cite-note-33. ↑ "Using dns-prefetch - Web performance | MDN". developer.mozilla.org. 2025-04-10. Retrieved 2025-04-24.
cite-note-44. ↑ "rel=prefetch - HTML: HyperText Markup Language | MDN". developer.mozilla.org. 2025-04-10. Retrieved 2025-04-24.
cite-note-55. ↑ "rel=preload - HTML: HyperText Markup Language | MDN". developer.mozilla.org. 2025-04-10. Retrieved 2025-04-24.